package msg

const (
	SUCCESS = 200
	ERROR   = 500

	UserStatusErr          = 1000
	FormRequiredErr        = 2000
	FileTypeNotAllow       = 4000
	NotEnoughFreeSpace     = 4005
	ExceedsUploadSizeLimit = 4006

	ErrorLoginCheckRequired      = 10001
	ErrorLoginCheckPwd           = 10002
	ErrorLoginCheckStatus        = 10003
	ErrorSetSession              = 10004
	ErrorUploadForm              = 10005
	ErrorUploadSave              = 10006
	ErrorSaveImgdata             = 10007
	ErrorUploadStore             = 10008
	ErrorUploadImgBase64NullByte = 10009
	ErrorUploadImgBase64Save     = 10010
	ErrorLoginCheckUser          = 10011
	ErrorLoginIP                 = 10012

	ErrorUpdate = 20001

	ErrorPwdBinding = 30001
	ErrorPwdConfirm = 30002
	ErrorPwd        = 30003
)

var Flags = map[int]string{
	SUCCESS:                      "操作成功",
	ERROR:                        "操作失败",
	ErrorLoginCheckRequired:      "用户名或密码不能为空",
	ErrorLoginCheckPwd:           "账号或密码错误",
	ErrorLoginCheckStatus:        "该账号已禁用",
	ErrorSetSession:              "服务器有误，请稍后重试",
	ErrorUploadForm:              "上传失败，请重试",
	ErrorUploadSave:              "图片保存失败",
	ErrorSaveImgdata:             "图片信息保存失败",
	ErrorUploadStore:             "上传到store失败，请检查配置源",
	ErrorUploadImgBase64NullByte: "图片base64数据接收失败，请检查后重试",
	ErrorUploadImgBase64Save:     "图片保存失败，请检查后重试",
	ExceedsUploadSizeLimit:       "图片超出上传大小限制",
	NotEnoughFreeSpace:           "可用空间不足",
	FileTypeNotAllow:             "文件类型不符合要求",
	UserStatusErr:                "上传失败，管理员已经关闭你的上传功能",
	ErrorUpdate:                  "数据更新失败",
	ErrorLoginCheckUser:          "用户不存在",
	ErrorPwdBinding:              "必填项未填写",
	ErrorPwdConfirm:              "两次密码不一致，请重新提交",
	ErrorPwd:                     "原密码错误，请重新提交",
	ErrorLoginIP:                 "密码错误次数超限，请稍后重试",
	FormRequiredErr:              "请填写必填项",
}

func GetMsg(code int) string {
	msg, ok := Flags[code]
	if ok {
		return msg
	}
	return Flags[ERROR]
}
